package com.tuweiya.study.hibernate.hibernateUtil;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
/**
 * @Author : Tu Wei Ya
 * @Date : Create in 2018/1/5
 * @Modify :
 * @Description : Hibernate的辅助类
 */
public class HibernateUtil {

    private static final SessionFactory sessionFactory ;
    static {
        sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory() ;
    }

    public static SessionFactory getSessionFactory(){
        return sessionFactory ;
    }

    public static void closeSessionFactory(){
        sessionFactory.close();
    }


}
